package ui;

import data.Node;
import logic.GraphGenerator;
import logic.GraphProcessing;
import logic.GraphProcessing.BreadthFirstIterator;
import logic.GraphProcessing.DepthFirstIterator;

public class testTreeSearchPerformance {
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		
		GraphGenerator.Graph graph = GraphGenerator.GenerateRandomGraph_constNodeSize(1000000, 20);
		
		//System.out.println(graph);
		
		Node focusNode = graph.getNodeList().get(0);//(int)(Math.random()*graph.getNodeList().size()));
		System.out.println("================generate tree with focus node "+focusNode.getID()+"===============");
		GraphProcessing gp = new GraphProcessing();
		System.out.println("Started tree generation");
		long time = System.currentTimeMillis();
		gp.generateTree(focusNode);
		System.out.println("finished tree generation in "+(System.currentTimeMillis()-time)+" milli seconds");
		BreadthFirstIterator bfi = gp.iteratorBreadthFirst();
		System.out.println("Started breadth first");
		time = System.currentTimeMillis();
		while (bfi.hasNextGeneration()){
			//LinkedList<Node>generation = bfi.nextGeneration();
			while(bfi.hasNext()){
				bfi.next();
			}
		}
		System.out.println("finished breadth first in "+(System.currentTimeMillis()-time)+" milli seconds");
		System.out.println("Started depth first");
		time = System.currentTimeMillis();
		DepthFirstIterator dfi = gp.iteratorDepthFirst();
		while(dfi.hasNext()){
			dfi.next();
		}
		System.out.println("finished depth first in "+(System.currentTimeMillis()-time)+"  milli seconds");
	}

}